<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>教师</title>

<style type="text/css">
<!--
body {
	margin:0px;
}
.list_content {
	background-color: #fff;
	color:#73938E;
	font-size:12px;
	line-height:15px;
	text-align:center;
}
.STYLE1 {color: #FF0000}
.STYLE2 {	
	color: #73938E;
	font-weight: bold;
}
.fenye{
    clear:both;
	text-align:center;	
}
.fenye dt { 
    text-align:center;
	float: left; 
	margin: 2px; 
	padding: 0 5px 0 5px; 
}
-->
</style>
</head>
<script language="javascript">
function notEmpty(){
	if(addForm.userName.value==""){
	alert('您没有输入用户名！');
	addForm.userName.select();
	return false;
	}
	if(addForm.userPwd.value==""){
	alert('您没有输入密码！');
	addForm.userPwd.select();
	return false;
	}
	if(addForm.reuserPwd.value==""){
	alert('您没有输入重复密码！');
	addForm.reuserPwd.select();
	return false;
	}
	if(addForm.userPwd.value!=addForm.reuserPwd.value){
	alert('两次密码输入不一致！');
	addForm.reuserPwd.select();
	return false;
	}
	return true;
}
function delcfm(){
    if(!confirm("确认要删除账户吗？")){
        window.event.returnValue = false;
    }
}
function acfm(){
    if(!confirm("确认要禁用该用户吗？")){
        //window.event.returnValue = false;
		if(window.event)
		   window.event.returnValue = false;
		else
		   e.preventDefault();//for firefox
    }
}
function bcfm(){
    if(!confirm("确认要启用该用户吗？")){
        //window.event.returnValue = false;
		if(window.event)
		   window.event.returnValue = false;
		else
		   e.preventDefault();//for firefox
    }
}
</script>
<body>
<?php
 session_start();
 include("../main/function.php");
 include("../main/ShowPage.class.php");
 include("../main/islogin.php");
 $db=new Db();
 
 //如果是教务处管理员登录，则加改管理员所在地区id
 $swhere=" 1=1 ";
 if($_SESSION['area_id']){
	$area_id=$_SESSION['area_id'];
	$swhere.=" and c.aid=$area_id";
 }
 
 $sql = "select * from (SELECT a.*,b.area as aid FROM teacher_user a left join teacher b on a.idcard=b.idcard) c where $swhere ";
 //分页处理
 $num=$db->rowNum($sql);//获取表记录数
 $page=new ShowPage();//建立分页对象page
 $page->PageSize=20;//设置分页显示的条数
 $page->Total=$num;
 $page->LinkAry=array();
 $showpage=$page->ShowLink();//设置分页导航
 $limit=$page->OffSet();
 
 $teacherInfo=$db->fetchRows("select * from (SELECT a.*,b.area as aid FROM teacher_user a left join teacher b on a.idcard=b.idcard) c where $swhere limit $limit");
 
 
?>
<TABLE cellSpacing=0 cellPadding=0 width="100%" align=center border=0>
<TR height=28 >
<TD background=../images/title_bg1.jpg>-->当前位置: 教师用户列表</TD>
</TR>
<tr>
<td>&nbsp;</td>
</tr>
<TR>
<td width="837"> <div align="center">
  <?php  echo "共有".$num."名教师用户："."<br>"; ?>
</div></td>
</tr>
</table>
<table width="50%" border="1" align="center"  cellpadding="3" cellspacing="0"   bordercolor="#F3F8F7">
  <tr align="center"  >
    <td bgcolor="#F3F8F7" ><span class="STYLE2">教师</span></td>
	<td bgcolor="#F3F8F7" ><span class="STYLE2">身份证</span></td>
	<td bgcolor="#F3F8F7" ><span class="STYLE2">操作</span></td>
  </tr>
   <?PHP $n=0; while($n<15) { if($teacherInfo[$n]['id']==NULl) break;?>
  <tr align="center">
    <td class="list_content" width="211"><?php echo $teacherInfo[$n]['username'] ?></td>
	<td class="list_content" width="211"><?php echo $teacherInfo[$n]['idcard'] ?></td>	
    <td class="list_content" width="151">	
	<?php if( $teacherInfo[$n][state]==1)
	{ ?>
	 <a href='delete_teacherUser.php?action=a&amp;teacher_id=<?php echo $teacherInfo[$n][id] ?>' class='STYLE1' onclick='acfm()'>禁用</a>
	<?php } 
	else 	
	{ 	?>
	<a href="delete_teacherUser.php?action=b&amp;teacher_id=<?php echo $teacherInfo[$n][id] ?>" class="STYLE2" onclick="bcfm()">启用</a>
	<?php } ?>
	 <a href="delete_teacherUser.php?teacher_id=<?php echo $teacherInfo[$n][id] ?>" onclick="delcfm()">删除</a></td>
  </tr>
   <?php $n++;} ?>
  
 <tr align="center">
    <td colspan="3" ><div class="fenye"><?php echo $showpage; ?></div></td>
  </tr>
</table>
</div>
</body>
</html>
